﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using TRPOP.CRM.Component.Model;
using TRPOP.CRM.Component.DALSQLServer;

namespace TRPOP.CRM.Component.Business
{
    /// <summary>
    /// 客户基本的逻辑处理代码
    /// </summary>
    public class BaseManage
    {
        #region 客户类型
        /// <summary>
        /// 获取所有的 客户类型
        /// </summary>
        /// <returns></returns>
        public static List<CompanyCategoryInfo> GetAllCompanyCategoryInfo()
        {
            return new CompanyCategoryDAL().GetListByCondition(0, " AND [bIsDelete]=0 ", " [iSortOrder] ASC ");
        }

        /// <summary>
        /// 用ID获取客户信息
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static CompanyCategoryInfo GetCompanyCategoryInfoByID(int intID)
        {
            return new CompanyCategoryDAL().GetInfoById(intID);
        }

        /// <summary>
        /// 保存客户类型信息
        /// </summary>
        /// <param name="oCompanyCategoryInfo"></param>
        /// <returns></returns>
        public static bool SaveCompanyCategoryInfo(CompanyCategoryInfo oCompanyCategoryInfo)
        {
            return new CompanyCategoryDAL().Save(oCompanyCategoryInfo);
        }
        #endregion

        #region 客户等级
        /// <summary>
        /// 获取所有的 客户等级信息
        /// </summary>
        /// <returns></returns>
        public static List<CompanyGradeInfo> GetAllCompanyGradeInfo()
        {
            return new CompanyGradeDAL().GetListByCondition(0, " AND [bIsDelete]=0 ", "  [iSortOrder] ASC  ");
        }
        /// <summary>
        /// 用ID获取客户等级
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static CompanyGradeInfo GetCompanyGradeInfoByID(int intID)
        {
            return new CompanyGradeDAL().GetInfoById(intID);
        }
        /// <summary>
        /// 保存客户等级
        /// </summary>
        /// <param name="oCompanyGradeInfo"></param>
        /// <returns></returns>
        public static bool SaveCompanyGradeInfo(CompanyGradeInfo oCompanyGradeInfo)
        {
            return new CompanyGradeDAL().Save(oCompanyGradeInfo);
        }
        #endregion

        #region 客户来源
        /// <summary>
        /// 获取全部的 客户来源类别
        /// </summary>
        /// <returns></returns>
        public static List<CompanySourceInfo> GetAllCompanySourceInfo()
        {
            return new CompanySourceDAL().GetListByCondition(0, "AND [bIsDelete]=0", "[iSortOrder] ASC");
           // return new List<CompanySourceInfo>();
        }
        /// <summary>
        /// 通过ID获取客户来源
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static CompanySourceInfo GetCompanySourceInfoById(int intID)
        {
            return new CompanySourceDAL().GetInfoById(intID);
        }
        /// <summary>
        /// 保存客户来源
        /// </summary>
        /// <param name="oCompanySourceInfo"></param>
        /// <returns></returns>
        public static bool SaveCompanySourceInfo(CompanySourceInfo oCompanySourceInfo)
        {
            return new CompanySourceDAL().Save(oCompanySourceInfo);
        }
        #endregion

        #region 员工状态
        /// <summary>
        /// 获取所有的员工状态信息
        /// </summary>
        /// <returns></returns>
        public static List<EmployeeStatuInfo> GetAllEmployeeStatuInfo()
        {
            return new EmployeeStatuDAL().GetListByCondition(0, "AND [bIsDelete]=0", "[iSortOrder] ASC");
            //return new List<EmployeeStatuInfo>();
        }
        /// <summary>
        /// 获取员工状态信息
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static EmployeeStatuInfo GetEmployeeStatuInfoById(int intID)
        {
            return new EmployeeStatuDAL().GetInfoById(intID);
        }
        /// <summary>
        /// 保存员工状态信息
        /// </summary>
        /// <param name="oEmployeeStatuInfo"></param>
        /// <returns></returns>
        public static bool SaveEmployeeStatuInfo(EmployeeStatuInfo oEmployeeStatuInfo)
        {
            return new EmployeeStatuDAL().Save(oEmployeeStatuInfo);
        }
        #endregion

        #region 跟踪信息
        /// <summary>
        /// 获取所有的 跟踪信息
        /// </summary>
        /// <returns></returns>
        public static List<FollowUpCategoryInfo> GetAllFollowUpCategoryInfo()
        {
            return new FollowUpCategoryDAL().GetListByCondition(0, "AND [bIsDelete]=0", "[iSortOrder] ASC");
            //return new List<FollowUpCategoryInfo>();
        }
        /// <summary>
        /// 根据ID获取跟踪类型
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static FollowUpCategoryInfo GetFollowUpCategoryInfoById(int intID)
        {
            return new FollowUpCategoryDAL().GetInfoById(intID);
        }
        /// <summary>
        /// 保存跟踪类型信息
        /// </summary>
        /// <param name="oFollowUpCategoryInfo"></param>
        /// <returns></returns>
        public static bool SaveFollowUpCategoryInfo(FollowUpCategoryInfo oFollowUpCategoryInfo)
        {
            return new FollowUpCategoryDAL().Save(oFollowUpCategoryInfo);
        }
        #endregion

        #region 职位信息
        /// <summary>
        /// 获取所有的职位信息
        /// </summary>
        /// <returns></returns>
        public static List<JobTitleInfo> GetAllJobTitleInfo()
        {
            return new JobTitleDAL().GetListByCondition(0, "AND [bIsDelete]=0", "[iSortOrder] ASC");
            //return new List<JobTitleInfo>();
        }

        /// <summary>
        /// 根据ID 获取 JobTitleInfo
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static JobTitleInfo GetJobTitleInfoById(int intID)
        {
            return new JobTitleDAL().GetInfoById(intID);
        }

        /// <summary>
        /// 保存职位信息
        /// </summary>
        /// <param name="oJobTitleInfo"></param>
        /// <returns></returns>
        public static bool SaveJobTitleInfo(JobTitleInfo oJobTitleInfo)
        {
            return new JobTitleDAL().Save(oJobTitleInfo);
        }
        #endregion

        #region 计划信息
        /// <summary>
        /// 获取所有的 计划类别
        /// </summary>
        /// <returns></returns>
        public static List<RemindCategoryInfo> GetAllRemindCategoryInfo()
        {
            return new RemindCategoryDAL().GetListByCondition(0, "AND [bIsDelete]=0", "[iSortOrder] ASC");
            //return new List<RemindCategoryInfo>();
        }
        /// <summary>
        /// 获取特定ID的计划类型
        /// </summary>
        /// <param name="intID"></param>
        /// <returns></returns>
        public static RemindCategoryInfo GetRemindCategoryInfoById(int intID)
        {
            return new RemindCategoryDAL().GetInfoById(intID);
        }
        /// <summary>
        /// 保存计划类型
        /// </summary>
        /// <param name="oRemindCategory"></param>
        /// <returns></returns>
        public static bool SaveRemindCategoryInfo(RemindCategoryInfo oRemindCategory)
        {
            return new RemindCategoryDAL().Save(oRemindCategory);
        }
        #endregion

        #region 记录系统日志
        /// <summary>
        /// 记录系统日志
        /// </summary>
        /// <param name="oSystemLogInfo"></param>
        public static void SaveSystemLog(SystemLogInfo oSystemLogInfo)
        {
            new SystemLogDAL().Save(oSystemLogInfo);
        }
        #endregion
    }
}
